import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '项目',
    align: "center",
    dataIndex: 'projectId_dictText'
  },
  {
    title: '人员',
    align: "center",
    dataIndex: 'resumeId_dictText'
  },
  {
    title: '评价人',
    align: "center",
    dataIndex: 'departureBy'
  },
  {
    title: '离场状态',
    align: "center",
    dataIndex: 'departureStatus_dictText'
  },
  {
    title: '离场时间',
    align: "center",
    dataIndex: 'departureTime',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text);
    },
  },
  {
    title: '离场评价',
    align: "center",
    dataIndex: 'departureEvaluate'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '项目',
    field: 'projectId',
    component: 'JSearchSelect',
    componentProps:{
      dict: "tm_project,project_name,id"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入项目!'},
             ];
    },
  },
  {
    label: '离场状态',
    field: 'departureStatus',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "departure_status"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入离场状态!'},
             ];
    },
  },
  {
    label: '离场时间',
    field: 'departureTime',
    component: 'DatePicker',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入离场时间!'},
             ];
    },
  },
  {
    label: '离场评价',
    field: 'departureEvaluate',
    component: 'InputTextArea',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入离场评价!'},
             ];
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  projectId: {title: '项目',order: 0,view: 'sel_search', type: 'string',dictTable: "tm_project", dictCode: 'id', dictText: 'project_name',},
  departureBy: {title: '评价人',order: 1,view: 'text', type: 'string',},
  departureStatus: {title: '离场状态',order: 2,view: 'list', type: 'string',dictCode: 'departure_status',},
  departureTime: {title: '离场时间',order: 3,view: 'date', type: 'string',},
  departureEvaluate: {title: '离场评价',order: 4,view: 'textarea', type: 'string',},
};
